#include <bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define in read<int>()
#define lin read<ll>()
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using vec = vector < int >;
using veg = vector < pii >;

template < typename T > T read() {
	T x = 0; bool f = 0; char ch = getchar();
	while(!isdigit(ch)) f |= ch == '-', ch = getchar();
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}

template < typename T > void chkmax(T &x, const T &y) { x = x > y ? x : y; }
template < typename T > void chkmin(T &x, const T &y) { x = x < y ? x : y; }

const int N = 710;
const int mod = 1e9 + 7;

int ans;
int f[N][N][2], n, pw[N];
char s[N];

void upd(int &x) { x = x + (x >> 31 & mod); }

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	scanf("%s", s + 1); n = strlen(s + 1);
	pw[0] = 0; rep(i, 1, n) pw[i] = pw[i - 1] * 10ll % mod + 1;
	rep(k, 1, 9) {
		memset(f, 0, sizeof f);
		f[1][0][1] = 1;
		rep(i, 1, n) {
			rep(j, 0, i - 1)
				rep(fl, 0, 1) if(f[i][j][fl]) {
				int up = fl ? s[i] - '0' : 9;
				rep(d, 0, up)
					upd(f[i + 1][j + (d >= k)][fl & (d == up)] += f[i][j][fl] - mod);
			}
		}
		rep(j, 0, n) rep(fl, 0, 1) upd(ans += 1ll * f[n + 1][j][fl] * pw[j] % mod - mod);
	} printf("%d\n", ans);
	return 0;
}
